import { routeListData } from 'src/assets/js/route-list'
const routes = [
  {
    path: '/main',
    name: 'main',
    component: () => import('layouts/MyLayout.vue'),
    children: [
      { path: '', redirect: 'home' },
      // 主页
      { path: 'home', name: 'home', meta: { keepAlive: true }, component: () => import('pages/home/home-v2') },
      { path: 'user', name: 'user', meta: { keepAlive: false }, component: () => import('pages/home/user') },
      { path: 'message', name: 'user', meta: { keepAlive: false }, component: () => import('pages/home/message') },
      { path: 'shop', name: 'shop', meta: { keepAlive: false }, component: () => import('pages/home/shop') },

      // 状态监控-机台状态
      { path: 'status/machine/machine-detail', name: 'machineDetail', meta: { keepAlive: false }, component: () => import('pages/status/machine-detail') },
      // 程序传输-在线加工-加工详情
      { path: 'program/online-process/onlineProcessDetail', name: 'online-process-detail', meta: { keepAlive: false }, component: () => import('pages/program/online-process-detail') },
      // 状态监控-机台状态详情V2
      // { path: 'status-monitor/machine-list/machine-detail', name: 'statusMachineDetail', component: () => import('pages/status-monitor/machine-detail') },
      { path: 'status-monitor-v3/socketTest', name: 'socketTest', component: () => import('pages/status-monitor-v3/socketTest') },
      ...routeListData
    ]
  },
  {
    path: '/login',
    component: () => import('pages/login'),
    children: [
      { path: '', redirect: 'password' },
      { path: 'password', name: 'password', meta: { keepAlive: false }, component: () => import('pages/login/password') },
      { path: 'reset', name: 'reset', meta: { keepAlive: false }, component: () => import('pages/login/reset') },
      { path: 'sure-phone', name: 'sure-phone', meta: { keepAlive: false }, component: () => import('pages/login/sure-phone') },
      { path: 'code', name: 'code', meta: { keepAlive: false }, component: () => import('pages/login/code') }
    ]
  },
  {
    path: '/',
    redirect: '/main'
  },
  {
    path: '/401',
    component: () => import('layouts/MyLayout.vue'),
    children: [
      { path: '', name: 'password', meta: { keepAlive: false }, component: () => import('pages/Error401.vue') }
    ]
  }
]

// Always leave this as last one
if (process.env.MODE !== 'ssr') {
  routes.push({
    path: '/404',
    component: () => import('pages/Error404.vue')
  })
}

export default routes
